package com.algorithm;

/**
 * @author: sun.hongliang
 * @create: 2019/07/17 11:21
 */
public class LowCaseTest {
    public static void main(String[] args) {
        char a = 'a';
        char A = 'A';
        char z = 'z';
        char Z = 'Z';
        System.out.println((int) a);
        System.out.println((int) A);
        System.out.println((int) z);
        System.out.println((int) Z);

        System.out.println(toLowCase("Abc"));
    }

    public static String toLowCase(String str) {
        char[] chars = str.toCharArray();
        int length = chars.length;
        char[] temp = new char[length];
        for (int i = 0; i < length; i++) {
            if (chars[i] >= 'A' && chars[i] <= 'Z') {
                temp[i] = (char) ((int) chars[i] + 32);
            } else {
                temp[i] = chars[i];
            }
        }
        return new String(temp);
    }
}
